<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ForTheHost</title>
    <link rel="stylesheet" href="static/layui/css/layui.css">
    <script src="static/layui/layui.js"></script>
</head>
<body>
<div class="layui-bg-green" align="center">
    面向主机的端口扫描(当前唯一源IP和目的端口)
</div>

<div class="layui-card">
    <div class="layui-card-body">
        <table id="Host" lay-filter="Host"></table>
    </div>
</div>

<script type="text/javascript">
    layui.use(['table', 'jquery','form', 'layer','upload'], function () {
        var table = layui.table;
        var $ = layui.jquery;
        var form = layui.form;
        var layer = layui.layer;
        var upload = layui.upload;
        table.render({
            elem: '#Host'
            , url: '/ip/getIpAndPortCount'
            , title: '面向主机的端口扫描'
            , totalRow: true
            , cols: [[  //表头
                {field: 'src_IP', title: '源IP'},
                {field: 'dst_PORT', title: '目的端口'}
            ]],
            parseData: function (res) {
                console.log(res);
                if (res.data.src_IP - res.data.dst_PORT > 1500) {
                    layer.msg("本地出现疑似面向主机的端口扫描！");
                } else {
                    layer.msg("本地暂未监测到面向主机的端口扫描！");
                }
                return {
                    "code": 0,
                    "msg": res.msg,
                    "count": res.data.length,
                    "data": res.data
                }
            },
        });

    })
</script>
</body>
</html>